package com.schoolhelper.model;

import android.content.Context;

import java.util.HashMap;
import java.util.Map;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;

public class Model {
    private Context mContext;
    protected Map<Key,Object> valueCache = new HashMap<Key,Object>();
    private ExecutorService executors = Executors.newCachedThreadPool();
    private ExecutorService singleExecutors = Executors.newSingleThreadExecutor();

    // 创建对象
    private static Model model = new Model();

    // 私有化构造
    private Model() {

    }

    // 获取单例对象
    public static Model getInstance(){

        return model;
    }

    // 初始化的方法
    public void init(Context context){
        mContext = context;
    }

    // 获取全局线程池对象
    public ExecutorService getGlobalThreadPool(){
        return executors;
    }

    public ExecutorService getGlobalSingleThreadPool() {
        return singleExecutors;
    }

    enum Key{
        VibrateAndPlayToneOn,
        VibrateOn,
        PlayToneOn,
        SpakerOn,
        DisabledGroups,
        DisabledIds
    }
}
